package com.shop.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.Date;
import java.util.List;

@Mapper
public interface ScheduleMapper{
    @Select("select id from merchant_merchant where merchant_status=1 and examine_status=1")
    List<Integer> getAllMerchantId();

    @Select("select count(0) from `order` where merchant_id=#{id} and #{late}<create_time and create_time<#{now} and status=5")
    int getMonthSale(@Param("id") Integer id, @Param("late") Date lateMonth,@Param("now") Date date);

    @Update("update merchant_merchant set merchant_monthly_sales=#{amount} where id=#{id}")
    void setMonthSale(@Param("id") Integer id, @Param("amount") int amount);
}
